package com.leetcode.LC;

import java.util.HashSet;

public class LC771 {
    public int numJewelsInStones(String jewels, String stones) {

        if (jewels.length()==0||stones.length()==0){
            return 0;
        }

        HashSet<Character> set = new HashSet<>();
        for (int i = 0; i < jewels.length(); i++) {
            set.add(jewels.charAt(i));
        }
        int count=0;
        for (int i = 0; i < stones.length(); i++) {
            if (set.contains(stones.charAt(i))){
                count++;
            }
        }

        return count;
    }

    public static void main(String[] args) {
        System.out.println(new LC771().numJewelsInStones("aA", "aAAbbbb"));
    }
}
